<template>
    <div class="header-wrap">
        <div class="common-head">
            <a href="/" class="logo"><img src="../../common/img/logo.png" alt="中厚明德_引领特色小镇新风向" title="中厚明德_引领特色小镇新风向" ></a>
            <div class="contact">
                <img class="head-tel" src="../../common/img/head-tel.png">
                <div class="head-contact">
                    <p>工作时间:9:00--18:00</p>
                    <span>010-80456661</span>
                </div>
            </div>
            <div class="hamburger" @click="navToggle">
                <div class="hamburger-inner"></div>
            </div>
        </div>
        <transition name="navSlide">
            <div class="main-nav-wrap" v-show="navShow">
                <div class="sidebar">
                    <el-menu :default-active="onRoutes" class="el-menu-vertical-demo" theme="dark" unique-opened router>
                        <template v-for="item in items">
                            <template v-if="item.subs">
                                <el-submenu :index="item.index">
                                    <template slot="title">{{ item.title }}</template>
                                    <el-menu-item @click="navToggle" v-for="(subItem,i) in item.subs" :key="i" :index="subItem.index">
                                        {{ subItem.title }}
                                    </el-menu-item>
                                </el-submenu>
                            </template>
                            <template v-else>
                                <el-menu-item :index="item.index" @click="navToggle">
                                    {{ item.title }}
                                </el-menu-item>
                            </template>
                        </template>
                    </el-menu>
                </div>
            </div>
        </transition>
        <div class="common-bg" v-show="navShow"  @click="navToggle"></div>
    </div>

</template>
<script type="text/javascript">

export default{
    data(){
        return{
            navShow:false,
            items: [
                {
                    index: '/',
                    title: '首页'
                },
                {
                    index: 'info',
                    title: '资讯'
                },
                {
                    index: 'industry-alliance',
                    title: '产业联盟'
                },
                {
                    index: '4',
                    title: '产城智库',
                    subs: [
                        {
                            index: 'tank-town',
                            title: '小镇名录',
                        },
                        {
                            index: 'tank-app',
                            title: '产城智库App'
                        }
                    ]
                },
                {
                    index: '5',
                    title: '规划咨询',
                    subs: [
                        {
                            index: 'plan-town',
                            title: '特色小镇'
                        },
                        {
                            index: 'plan-countryside',
                            title: '田园综合体'
                        },
                        {
                            index: 'plan-estate',
                            title: '产业地产'
                        },
                        {
                            index: 'plan-tour',
                            title: '文化旅游'
                        },
                        {
                            index: 'plan-park',
                            title: '园区规划'
                        }
                    ]
                },
                {
                    index: 'capital',
                    title: '资本运营'
                },
                {
                    index: '7',
                    title: '商学院',
                    subs: [
                        {
                            index: 'business-town',
                            title: '特色小镇落地班',
                        },
                        {
                            index: 'business-block',
                            title: '区块链'
                        },
                        {
                            index: 'business_secret',
                            title: '董秘特训营'
                        }
                    ]
                },
                {
                    index: '8',
                    title: '关于我们',
                    subs: [
                        {
                            index: 'about-brief',
                            title: '公司简介',
                        },
                        {
                            index: 'about-contact',
                            title: '联系我们'
                        }
                    ]
                },
            ]
        }
    },
    computed:{
        onRoutes(){
            return this.$route.path.replace('/','')
        }
    },
    methods:{
        navToggle:function(){
            this.navShow=!this.navShow
        }
    }
}
</script>
<style type="text/css">
.header-wrap{
    width: 100%;
    height: 51px;
    /* overflow: hidden; */
    position: fixed;
    left:0;
    top:0;
    z-index: 800;
}
.common-head{
    width: 100%;
    height: 50px;
    background: #fff;
    display: flex;
    border-bottom: 1px solid #e2e2e3;
    position:absolute;
    z-index: 600;
}
.logo{
    width: 90px;
    height: 24px;
    margin:15px 22px 11px 14px;
}
.logo img{width:100%;}
.contact{
    width: 180px;
    height: 50px;
}
.head-tel{
    width: 22px;
    height: 22px;
    margin: 13px 6px 13px 0;
    float: left;
}
.head-contact{
    margin:10px 0px;
    line-height: 14px;
    font-size: 12px;
    font-weight: bold;
}
.head-contact p{
    color: #000;
}
.head-contact span{
    color: #dc1f17;
}
/* 汉堡包样式 */
.hamburger {
    width:24px;
    height: 20px;
    padding:15px 14px 15px 14px;
    position: absolute;
    right: 0px;
    top:0;
    cursor: pointer;
}
.hamburger-inner{
    width:24px;
    height: 20px;
    background: url(../../common/img/head-btn.png) no-repeat;
    background-size: 100% 100%;
}
.navSlide-enter-active,
.navSlide-leave-active{transition: all 0.3s ease}
.navSlide-enter,
.navSlide-leave-to{
    transform: translate3d(80%,0,0);
}

/* 导航 */
.main-nav-wrap{
    position: fixed;
    right:0;
    top:51px;
    width:80%;
    height: 100%;
    background: #fff;
    z-index:800;
    font-size: 14px;
    transition: 0.3s ease-in;
    -webkit-transition: 0.3s ease-in;
    -moz-transition: 0.3s ease-in;
    -ms-transition: 0.3s ease-in;
    -o-transition: 0.3s ease-in;
}
.main-nav-wrap.show{
    right: 0;
}
.main-nav{
    width:100%;
    overflow-y:auto;
}
.el-menu-item, .el-submenu__title{
    height: 44px;
    line-height: 44px;
    background: #f5f5f5;
    border-bottom: 1px solid #e7e7e7;
}
.el-submenu.is-active .el-submenu__title{border-bottom-color:transparent;}
.el-submenu .el-menu-item{
    display: inline-block;
    padding:0 13px;
    background: #fff;
    border-bottom: none;
    min-width: auto;
}
.el-menu-item.is-active{color:#3d7fd5;background-color: #fff;}

.common-bg,
.tk-bg,
.tk-alert-bg{
    width: 100%;
    height: 100%;
    position: fixed;
    left:0;
    top:0;
    background: rgba(0,0,0,.5);
    z-index: 501;
}
.common-banner{
    width: 100%;
    min-height: 130px;
    background: #f5f5f5;
    /* border-bottom: 4px solid #f5f5f5; */
}
.common-banner img{width: 100%;}
.common-bannerInner{
    width: 100%;
    min-height: 130px;
    position: relative;
    background:#efefef url(../../common/img/loading.gif) no-repeat center center;
}
.index-pagination .swiper-pagination-bullet{
    opacity: 0.7;
    background: #fff;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -ms-border-radius: 50%;
    -o-border-radius: 50%;
}
.index-pagination .swiper-pagination-bullet-active{
    width: 25px;
    opacity: 1;
    border-radius: 4px;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    -ms-border-radius: 4px;
    -o-border-radius: 4px;
}
.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0px 3px;}
</style>
